<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="js/1.4.8/angular.js"></script>
</head>
<body>
<div ng-controller="myCtrl">
    <div>页面地址：{{url}}</div>
    <div>hash片段：{{hash}}</div>
    <div>查询字符：{{search}}</div>
    <div>页面路径：{{path}}</div>
    <button ng-click="btn_click()">修改</button>
</div>
<script type="text/javascript">
    var app = angular.module("app", [])
            .controller("myCtrl",["$scope","$location",function ($scope,$location) {
                $scope.url = $location.url();
                $scope.hash = $location.hash();
                $scope.search = $location.search();
                $scope.path = $location.path();
                $scope.btn_click = function () {
                    //$location.hash('e=5');
                    $location.url('https://www.baidu.com');
                    //$location.search({c:'3',d:'4'});
                }
            }]);
</script>
</body>
</html>